package com.huike.web.controller.business;

import com.huike.business.service.ITbBusinessTrackRecordService;
import com.huike.common.core.domain.AjaxResult;
import com.huike.business.domain.vo.BusinessRecordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.huike.common.core.controller.BaseController;

import java.util.ArrayList;

/**
 * 商机跟进记录Controller
 * @date 2021-04-28
 */
@RestController
@RequestMapping("/business/record")
public class TbBusinessTrackRecordController extends BaseController {

    @Autowired
    ITbBusinessTrackRecordService tbBusinessTrackRecordService;
    /**
     * 查询商机跟进历史记录
     * @param businessId
     * @return
     */
    @GetMapping("list")
    public AjaxResult list(Long businessId) {
    //调用service 创建 一个方法获取数据 根据商机id查询
       ArrayList<BusinessRecordVo> busines= tbBusinessTrackRecordService.selectTbBusinessRecordList(businessId);
        return AjaxResult.success("查询成功",busines);
    }

    @PostMapping
    public AjaxResult businessPost(@RequestBody BusinessRecordVo businessRecordVo){
        tbBusinessTrackRecordService.instTbBusinessRecord(businessRecordVo);
        return AjaxResult.success("添加成功");
    }

}
